#pragma once
#include <iostream>
#include <vector>
#include <ctime>

typedef void (*task_t) ();

// ////////// DeBug Task //////////
void PrintLog()
{
    std::cout << "Task executed PrintLog()." << std::endl;
}

void DownLoad()
{
    std::cout << "Task executed DownLoad()." << std::endl;
}

void Upload()
{
    std::cout << "Task executed Upload()." << std::endl;
}

class TaskManager
{
public:
    TaskManager()
    {
        srand(time(nullptr));
    }

    void Register(task_t task)
    {
        _tasks.push_back(task);
    }

    int Code()
    {
        return rand() % _tasks.size();
    }

    void Execute(int code)
    {
        if (code >= 0 && code < _tasks.size())
        {
            _tasks[code]();
        }
    }

    ~TaskManager() {}
private:
    std::vector<task_t> _tasks;
};